Flexible Online-Backup Capability For Any File System Type
This paper describes Programmed Logic Corporation's (PLC's) SnapShot module for the (Stackable File System) StackFS. SnapShot is a software product that provides online-backup capability for any file system type. SnapShot can be enabled per-file, per-directory, or per-file system. Online-backup capabilities are typically either not available at all or only available for limited file system types; SnapShot adds this capability to any file system type that can be exported over NFS. We describe the SnapShot architecture, the administrative interfaces to create and delete snapshots, and the method to use a snapshot.
snapshot a view of a file or file hierarchy frozen at some point in time snapped file a file whose state has been frozen in a snapshot save area a repository outside of a snapshot where the frozen state of files is saved
SnapShot is a module that plugs into the StackFS architecture. StackFS is PLC's stackable file system, which provides the ability to layer new features on top of existing file systems without the need to modify any part of the underlying operating system. SnapShot is mounted over other, ordinary file system types (like UFS or HTFS) or over other StackFS modules. It provides the ability to take snapshots of individual files or of the entire file system and to access snapped versions of files through an alternate naming scheme. The current version of any file is always accessible and modifiable through its normal pathname, and the snapped version(s) of the file are accessible through special pathnames, called snapshot paths, created when a snapshot is taken.
SnapShot works by intercepting all attempts to access files within a snapshot and saving copies of the original contents of a file before applying any changes to that file. Accesses to files through SnapShot are translated into accesses to files in the underlying file system or in a save area. Figure 1 illustrates the initial state, where all accesses to a file through either the normal path or the snapshot path are translated into accesses to the original file. Immediately before a snapped file is modified SnapShot makes a copy of the data being modified in an alternate location, specified when the snapshot was created. Thereafter all requests to access the original view still go to the original lower level file, but requests to access the snapshot view go to the saved copy (see figure 2).
There are two steps to using SnapShot. First, SnapShot is mounted over any other mounted file system. After this point SnapShot will intercept all file access requests, but it will simply pass them on to the lower level file system. Second, a snapshot is taken of any file or directory within that file system, or of the entire file system, specifying a name for the snapshot. The snapshot name then becomes an alternate view of the file, directory or file system in the state it was at the moment the snapshot was taken.
When SnapShot is first mounted it creates an empty pseudo-directory named "snapshots" under the mount point, which will contain all snapshots created in the mounted-on file system. If, for example, a snapshot is taken of a file "mydir/myfile" under the SnapShot mount and it is given the name "mysnap", then the pathname "mydir/myfile" will refer to the current version of the file and the pathname "snapshots/mysnap" will refer to the snapped version of the same file. The same model applies for snapping the entire file system -- if a snapshot is taken of the entire file system with the name "fssnap", then the snapped version of the file "mydir/myfile" is in "snapshots/fssnap/mydir/myfile".
The copies of snapped files are all stored in an initially empty directory specified when the snapshot is taken. This directory can be anywhere on the system, but it should not lie within a SnapShot mount point. It can even be in an NFS mounted file system, so a snapshot can be taken on a system that does not have any spare disk partitions or even spare file system space.
Deleting a snapshot removes the special name under the "snapshots" pseudo-directory and deletes all the copies in the save area. Once deleted, the snapshot is gone -- taking another snapshot on the same file will capture its state at the time the new snapshot is taken.
The first phase in using SnapShot is to enable snapshots to be taken. The second phase is to create the snapshot of the files you want to back up. StackFS comes with its own file-system-specific mount(1M) command that takes options specifying which modules you want to mount. So to mount SnapShot, you could issue the following command.
# mount -F stackfs -o snapshot /fs_to_snap /fs_to_snap
This enables SnapShot, but does not actually take a snapshot. The mount should be performed immediately after mounting the underlying file system, /fs_to_snap, to ensure that SnapShot gains control of all file activity on the file system. SnapShot includes commands to take and delete snapshots.
To create a snapshot using the above file names, run
# snapadmin -t /fs_to_snap/mydir/myfile mysnap save_area
or to take a snapshot of the entire file system, run
# snapadmin -t /fs_to_snap fssnap save_area
To delete a snapshot use the
# snapadmin -d /fs_to_snap/mydir/myfile mysnap
or
# snapadmin -d /fs_to_snap fssnap
Once a snapshot exists it can be read through the the following special pathnames: "/fs_to_snap/snapshots/mysnap" or "/fs_to_snap/snapshots/fssnap/..." using standard name-based backup tools such as cpio(1) or tar(1).
SnapShot provides an easy way to back up any file system on-line, regardless of whether the file system itself provides any online-backup capability, without requiring any changes to the underlying file systems. SnapShot works well on client systems that don't have much local disk space, because it can use space mounted via NFS from a large server machine to store copies of modified file blocks. This allows all of your systems to be available and accessible without downtime for backups.
For more information contact:
PROGRAMMED LOGIC CORPORATION
200 Cottontail Lane Somerset, NJ 08873
Phone: 908-302-0090; 1-800-967-0050; Fax: 908-302-1903
http://www.plc.com
Email: info@plc.com; sales@plc.com
This page, and all contents, are Copyright (C) 1995 by
Programmed Logic Corporation,
200 Cottontail Lane, Somerset, N.J. 08873,
U.S.A.